public class Solution1827 {
    public int minOperations(int[] nums) {
        int ans=0;
        for (int i=1;i<nums.length;i++){
            if (nums[i]<=nums[i-1]){
                ans+=nums[i-1]-nums[i]+1;
                nums[i]=nums[i-1]+1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1827().minOperations(new int[]{1,1,1}));
    }
}
